log using "C:\Users\J.PARK\Dropbox\Discrimination Project_for me\Organizational Diversity\2023 Version_Merging\FINAL\CFA_2019.smcl", replace  

import delimited "C:\Users\J.PARK\Dropbox\DISCRIMINATION PROJECT\FEVS\FEVS_2010-2019\FEVS_2019_PRDF_Revised_2020-04-27.csv"

drop if q17=="X"
drop if q17==""
drop if q37=="X"
drop if q37==""
drop if q38=="X"
drop if q38==""
drop if q15=="X"
drop if q15==""
drop if q22=="X"
drop if q22==""
drop if q25=="X"
drop if q25==""
drop if q33=="X"
drop if q33==""
drop if q48==.
drop if q49==.
destring q17, replace
destring q37, replace
destring q38, replace
destring q15, replace
destring q22, replace
destring q25, replace
destring q33, replace
drop if q55=="X"
drop if q55==""
drop if q45=="X"
drop if q45==""
drop if q34=="X"
drop if q34==""
destring q55, replace
destring q45, replace
destring q34, replace
drop if dsuper=="X"
drop if dsuper==""
drop if dsex=="X"
drop if dsex==""
drop if dminority=="X"
drop if dminority==""
gen minority = 0 if dminority=="B"
replace minority = 1 if dminority=="A"
gen gender = 1 if dsex == "B"
replace gender = 0 if dsex == "A"
gen supervisor = 1 if dsuper == "B" 
replace supervisor = 0 if dsuper == "A"

svyset [pweight=postwt]

svy linearized : sem (JUSTICE -> DISTRIBUTIVE, ) (JUSTICE -> PROCEDURAL, ) (JUSTICE -> INTERPERSONAL, ) (DISTRIBUTIVE -> q22, ) (DISTRIBUTIVE -> q25, ) (DISTRIBUTIVE -> q33, ) (PROCEDURAL -> q15, ) (PROCEDURAL -> q17, ) (PROCEDURAL -> q37, ) (PROCEDURAL -> q38, )(INTERPERSONAL -> q48, ) (INTERPERSONAL -> q49, ), standardized latent(JUSTICE DISTRIBUTIVE PROCEDURAL INTERPERSONAL ) nocapslatent

estat gof, stats(all)

predict justice, latent(JUSTICE)

svy linearized : sem (DIVERSITY -> q34, ) (DIVERSITY -> q45, ) (DIVERSITY -> q55, ), standardized latent(DIVERSITY) nocapslatent

estat gof, stats(all)

predict diversity, latent(DIVERSITY)

keep if agency =="AM" | agency =="IB" | agency =="FQ"| agency =="ED" | agency =="DN" | agency =="HU" | agency =="ST" | agency =="EP"  | agency =="EE"| agency =="FC" | agency =="DR" | agency =="FT" | agency =="GS" | agency =="NQ" | agency =="NN" | agency =="CU" | agency =="SN" | agency =="NL" | agency =="NF" | agency =="NU" | agency =="OM" | agency =="BG" | agency =="RR" | agency =="SE" | agency =="SB" | agency =="SZ" | level1 =="DD34" | level1 =="DD10" | level1 =="DD63" | level1 =="DD35" | level1 =="DD04" | level1 =="DD07" | level1 =="DD27" | level1 =="DD26" | level1 =="DD60" | level1 =="CM03" | level1 =="CM06" | level1 =="CM08" | level1 =="CM09" | level1 =="CM14" | level1 =="DD16" | level1 =="HE02" | level1 =="HE04" | level1 =="HE05" | level1 =="HE06" | level1 =="HE07" | level1 =="HE08" | level1 =="HE09" | level1 =="HE10" | level1 =="HE12" | level1 =="HS04" | level1 =="HS05" | level1 =="HS14" | level1 =="HS01" | level1 =="HS03" | level1 =="HS02" | level1 =="HS06" | level1 =="HS12" | level1 =="DJAT" | level1 =="DJBP" | level1 =="DJEA" | level1 =="DJIR" | level1 =="DJOA" | level1 =="DJFB" | level1 =="DJMS" | level1 =="DJTP" | level1 =="DL03" | level1 =="DL10" | level1 =="DL09" | level1 =="DL04" | level1 =="DL06" | level1 =="DL05" | level1 =="DL11" | agency =="AF" | agency =="AR" | level1 =="IN03" | level1 =="IN01" | level1 =="IN02" | level1 =="IN07" | level1 =="IN05" | level1 =="IN06" | level1 =="IN14" | agency =="NV" | level1 =="TRAI" | level1 =="TR91" | level1 =="TRFD" | level1 =="TR93" | level1 =="TRAJ" | level1 =="TRTG" | level1 =="TRAD" | level1 =="TD03" | level1 =="TD04" | level1 =="TD05" | level1 =="DD01"

svy linearized : sem (JUSTICE -> DISTRIBUTIVE, ) (JUSTICE -> PROCEDURAL, ) (JUSTICE -> INTERPERSONAL, ) (DISTRIBUTIVE -> q22, ) (DISTRIBUTIVE -> q25, ) (DISTRIBUTIVE -> q33, ) (PROCEDURAL -> q15, ) (PROCEDURAL -> q17, ) (PROCEDURAL -> q37, ) (PROCEDURAL -> q38, )(INTERPERSONAL -> q48, ) (INTERPERSONAL -> q49, ), standardized latent(JUSTICE DISTRIBUTIVE PROCEDURAL INTERPERSONAL ) nocapslatent

estat gof, stats(all)

predict justice2, latent (JUSTICE)

svy linearized : sem (DIVERSITY -> q34, ) (DIVERSITY -> q45, ) (DIVERSITY -> q55, ), standardized latent(DIVERSITY) nocapslatent

estat gof, stats(all)

predict diversity2, latent (DIVERSITY)

sum justice, detail

sum justice2, detail

sum diversity, detail

sum diversity2, detail

corr justice justice2

corr diversity diversity2 

log close

